{extend name="Public:content"}
{block name="content"}
<form class="form-horizontal m-t" id="addUserFrom"  method="post" action="{:url('admin/user/pass')}">
    <div class="form-group">
        <label class="col-sm-2 control-label">用户账号：</label>
        <div class="col-sm-8">
            {if $vo and $vo.username}
            <input readonly="readonly" disabled="disabled" name="username" value='{$vo.username|default=""}' required="required" title="请输入用户名称" placeholder="请输入用户名称" class="form-control">
            {else}
            <input name="username" value='{$vo.username|default=""}' required="required" title="请输入用户名称" placeholder="请输入用户名称" class="form-control">
            {/if}
        </div>
    </div>
    {if $verify}
    <div class="form-group">
        <label class="col-sm-2 control-label">旧的密码：</label>
        <div class="col-sm-8">
            <input type="password" autofocus name="oldpassword" value='' pattern="^\S{1,}$" required="" title="请输入旧的密码" placeholder="请输入旧的密码" class="form-control">
        </div>
    </div>
    {/if}
    <div class="form-group">
        <label class="col-sm-2 control-label">新的密码：</label>
        <div class="col-sm-8">
            <input type="password" name="password" value='' pattern="^\S{1,}$" required="" title="请输入新的密码" placeholder="请输入新的密码" class="form-control">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">重复密码</label>
        <div class="col-sm-8">
            <input type="password" name="repassword" value='' pattern="^\S{1,}$" required="" title="请输入重复密码" placeholder="请输入重复密码" class="form-control">
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="form-group">
        <div class="col-sm-12 text-center">
            {if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'/>{/if}
            <button class="btn btn-primary" type="submit">保存数据</button>
            <button class="btn btn-primary btn-danger" type='button' data-confirm="确定要取消编辑吗？" onclick="$.Oa.confirm(this)">取消编辑</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
    //表单提交
    $('#addUserFrom').validate({
        submitHandler: function(form) {
            $.Oa.doHform('#addUserFrom',false,false,function(data){
                parent.layer.msg(data.msg);
                // var iframe ='{$iframe}';
                // var n = parent.$("iframe[name='"+iframe+"']").index();
                // parent[n].location.reload();
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            })
        }
    })
</script>
{/block}

